{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1cb19486",
   "metadata": {},
   "source": [
    "## 上周回顾 \n",
    "> * list一般方法/函数的所有的使用场景及案例，方法如：\n",
    ">> 1. append()\n",
    ">> 2. pop(index)\\remove(values) \n",
    ">> 3. count() \n",
    ">> 4. index() \n",
    ">> 5. extend() \n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ae61953c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i\n",
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "# 本周内容\n",
    "# vowels.py\n",
    "vowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n",
    "word = \"Milliways\"\n",
    "# 需求：word中出现的vowels打印出来\n",
    "for i in word:\n",
    "    if i in vowels:\n",
    "        print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f93477fb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 1, 1]\n"
     ]
    }
   ],
   "source": [
    "# 新建列表，append常用于新建列表\n",
    "found = []\n",
    "for i in word:\n",
    "    if i in vowels:\n",
    "        if i not in found:\n",
    "            found.append(1)\n",
    "print(found)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "71534ce5",
   "metadata": {},
   "source": [
    "# 购物车程序项目：\n",
    "- 要求：\n",
    "1. 运行程序后，让用户输入支付宝余额，然后打印我们商品列表给用户。\n",
    "2. 让用户输入商品编号进行商品的购买。\n",
    "3. 用户选择商品后，检查用户的余额是否够，若够则直接扣款，不够则提醒用户。\n",
    "4. 用户可以随时退出购买，推出时打印用户已购买的商品和支付宝余额。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1bfea365",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 准备工作\n",
    "# 1. 商品信息\n",
    "goods_list = [('iphoneX',7000),('vivo',4000),('huawei',5000),('蓝牙耳机',2000)]\n",
    "# 2. 用户购物信息\n",
    "user_shopping_list = []\n",
    "# 用户输入(余额)：    #------知识点：打印与用户输入------\n",
    "Alipay = (int(input)('请输入支付宝余额'))\n",
    "# info = '''------- goods detail -------\n",
    "# 编号0，商品名称：%s,商品的价格:%s 元\n",
    "# 编号1，商品名称：%s,商品的价格:%s 元\n",
    "# 编号2，商品名称：%s,商品的价格:%s 元\n",
    "#编号3，商品名称：%s,商品的价格:%s 元\n",
    "#'''%(goods_list[0][0],goods_list[0][1],\n",
    "#    goods_list[1][0],goods_list[1][1],\n",
    "#    goods_list[2][0],goods_list[2][1],\n",
    "#    goods_list[3][0],goods_list[3][1],)\n",
    "# print(info) \n",
    "\n",
    "# for循环的优势，节省重复代码的书写\n",
    "while True: \n",
    "    print(\"------- goods detail -------\")\n",
    "for i in range(4):  #  i是0,1,2,3\n",
    "    print(\"编号%s，商品名称：%s,商品的价格:%s 元\" %(i,goods_list[i][0],goods_list[i][1]))\n",
    "    "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}